{% extends "account/base.html" %}

{% load i18n a17t_tags %}

{% block head_title %}{% trans "Change authentication info" %}{% endblock %}
{% block page_title %}{% trans "Change authentication info" %}{% endblock %}

{% block card %}
<form method="POST" action="{% url 'account_change_password' %}" class="password_change max-w-lg">
    {% csrf_token %}
    {{ form|a17t }}
    <button type="submit" name="action" class="button ~urge !high">{% trans "Change Password" %}</button>
</form>
<hr class="sep">
<div>
    <p class="label mb-1">Personal API token</p>
    <div class="flex justify-between">
      {% if request.user.api_token %}
      <span class='chip ~info !normal'>{{request.user.api_token}}</span>
      {% else %}
      <span>Token not generated</span>
      {% endif %}
      <form method="POST" action="{% url 'dashboard:api_token_refresh' %}">
        {% csrf_token %}
        <button type="submit" name="action" class="button ~neutral @high">
          {% if request.user.api_token %}
          {% trans "Refresh token" %}
          {% else %}
          {% trans "Generate token" %}
          {% endif %}
        </button>
      </form>
    </div>
    <p class="support mt-1">To learn more about the API, see our <a href="https://github.com/milesmcc/shynet/blob/master/GUIDE.md#api">API guide</a>.</p>
</div>
</div>
{% endblock %}
